package com.fc.v2.controller.gen;

import com.fc.v2.common.base.BaseController;
import com.fc.v2.common.domain.AjaxResult;
import com.fc.v2.common.domain.ResultTable;
import com.fc.v2.model.custom.Tablepar;
import com.fc.v2.model.auto.FinishSatgeResult;
import com.fc.v2.service.FinishSatgeResultService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

/**
 * 阶段性成果Controller
 * @ClassName: FinishSatgeResultController
 * @author Archie
 * @date 2021-11-08 17:40:54
 */
@Api(value = "阶段性成果")
@Controller
@RequestMapping("/FinishSatgeResultController")
public class FinishSatgeResultController extends BaseController{
	
	private String prefix = "gen/finishSatgeResult";
	
	@Autowired
	private FinishSatgeResultService finishSatgeResultService;
	
	
	/**
	 * 阶段性成果页面展示
	 * @param model
	 * @return String
	 * @author Archie
	 */
	@ApiOperation(value = "分页跳转", notes = "分页跳转")
	@GetMapping("/view")
	@RequiresPermissions("gen:finishSatgeResult:view")
    public String view(ModelMap model)
    {
        return prefix + "/list";
    }
	
	/**
	 * list集合
	 * @param tablepar
	 * @param searchText
	 * @return
	 */
	//@Log(title = "阶段性成果", action = "111")
	@ApiOperation(value = "分页跳转", notes = "分页跳转")
	@GetMapping("/list/{proId}")
	@RequiresPermissions("gen:finishSatgeResult:list")
	@ResponseBody
	public ResultTable list(Tablepar tablepar,FinishSatgeResult finishSatgeResult,@PathVariable("proId") String proId){
		PageInfo<FinishSatgeResult> page=finishSatgeResultService.list(tablepar,finishSatgeResult,proId) ;
		return pageTable(page.getList(),page.getTotal());
	}
	
	/**
     * 新增跳转
     */
	@ApiOperation(value = "新增跳转", notes = "新增跳转")
    @GetMapping("/add")
    public String add(ModelMap modelMap)
    {
        return prefix + "/add";
    }
	
    /**
     * 新增保存
     * @param 
     * @return
     */
	//@Log(title = "阶段性成果新增", action = "111")
	@ApiOperation(value = "新增", notes = "新增")
	@PostMapping("/add/{proId}")
	@RequiresPermissions("gen:finishSatgeResult:add")
	@ResponseBody
	public AjaxResult add(FinishSatgeResult finishSatgeResult,@PathVariable("proId") String proId){
		int b=finishSatgeResultService.insertSelectiveFinish(finishSatgeResult,proId);
		if(b>0){
			return success();
		}else{
			return error();
		}
	}
	
	/**
	 * 阶段性成果删除
	 * @param ids
	 * @return
	 */
	//@Log(title = "阶段性成果删除", action = "111")
	@ApiOperation(value = "删除", notes = "删除")
	@DeleteMapping("/remove")
	@RequiresPermissions("gen:finishSatgeResult:remove")
	@ResponseBody
	public AjaxResult remove(String ids){
		int b=finishSatgeResultService.deleteByPrimaryKey(ids);
		if(b>0){
			return success();
		}else{
			return error();
		}
	}
	
	
	/**
	 * 修改跳转
	 * @param id
	 * @param mmap
	 * @return
	 */
	@ApiOperation(value = "修改跳转", notes = "修改跳转")
	@GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap map)
    {
        map.put("FinishSatgeResult", finishSatgeResultService.selectByPrimaryKey(id));

        return prefix + "/edit";
    }
	
	/**
     * 修改保存
     */
    //@Log(title = "阶段性成果修改", action = "111")
	@ApiOperation(value = "修改保存", notes = "修改保存")
    @RequiresPermissions("gen:finishSatgeResult:edit")
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(FinishSatgeResult finishSatgeResult)
    {
        return toAjax(finishSatgeResultService.updateByPrimaryKeySelective(finishSatgeResult));
    }
    
    
    /**
	 * 修改状态
	 * @param record
	 * @return
	 */
    @PutMapping("/updateVisible")
	@ResponseBody
    public AjaxResult updateVisible(@RequestBody FinishSatgeResult finishSatgeResult){
		int i=finishSatgeResultService.updateVisible(finishSatgeResult);
		return toAjax(i);
	}

    
    

	
}
